package com.qcby.shujia.demo.common.web;

import com.github.pagehelper.Page;

import java.util.List;

/**
 * @className: PageData
 * @description: 分页信息
 * @author: whz
 * @date: 2021/9/23
 **/
public class PageData {
    private int pageNo;
    private int pageSize;
    private long totalCount;
    private int totalPages;
    private List<Object> list;

    public static PageData build(Page page){
        return new PageData(page.getPageNum(),page.getPageSize()
        ,page.getTotal(),page.getPages(),page.getResult());
    }


    private PageData(int pageNo, int pageSize, long totalCount, int totalPages, List<Object> list) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.totalPages = totalPages;
        this.list = list;
    }

    public List<Object> getList() {
        return list;
    }

    public void setList(List<Object> list) {
        this.list = list;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }
}
